Repository navigation
Upgrade test fixtures to 2.x project layouts - #1301
Conversation
5ce2eb6 to
7349a80
Compare
There was a problem hiding this comment.
FWIW, this option is not covered by your new tests, because the tests are explicitly overriding this option in models.json. Please consider writing few more test to verify that a) the built-in user disables include of access tokens b) user submodels inherit this setting by default too.
|
The model change is not covered by tests. Other than that, the patch LGTM. |
9abcb08 to
68a2344
Compare
|
@bajtos PTAL again. I had to convert the test apps into LB 2.x layout, which is a great side effect. |
For posterity, can you please explain why was this needed?
|
There was a problem hiding this comment.
Is there any particular reason why you are not using middleware.json and middleware phases in this app?
Are your tests relying on cookieParser at all? And why do they need static files from the public directory?
There was a problem hiding this comment.
No, I just copied them from the existing fixture. I can clean them up.
Actually I think this is a wrong thing to do. LoopBack tests should not depend on loopback-boot, they should setup the application via code only.
IIRC, the main reason why the existing LoopBack tests are depending on loopback-boot is to ensure that LoopBack 1.x apps can be upgraded to LoopBack 2.x + loopback-boot 1.x with no breaking changes. I think this issue deserves some discussion and it will be best to decouple it from your work on "Set disableInclude for User->AccessToken relation". Is there any way how to finish your fix without upgrading loopback-boot? |
The project already has dependency on Migrating from 1.x to 2.x is not a main concern any more. I think it's better to use 2.x layout as developers sometimes try to follow what we do. If you feel strongly about removing the test fixtures, we can discuss that as a separate issue. With 1.x layout, there is no way to use the base class such as |
68a2344 to
bb3f971
Compare
I dig up the commit that added the dependency on loopback-boot - see c896c78. It seems the change was made purely in order to support test fixtures booting the app via However, I still believe that we should keep the number of fixtures as small as possible, create loopback apps inside the tests purely code-wise and keep these apps as small as possibly. |
bb3f971 to
b6efccc
Compare
|
I decoupled the LB 2.x upgrade from |
There was a problem hiding this comment.
Is there any particular reason why your are not using HTTP path /users? That way you will not have to change URLs in all the test cases below.
There was a problem hiding this comment.
Yes, because the model in use is a sub-model of User. If we don't explicitly specify http.path, it will default to /testusers.
There was a problem hiding this comment.
So why can't you specify http.path: 'users', or even plural: 'Users', since you are already overriding the default?
There was a problem hiding this comment.
Anyways. If you believe that it's better to have /test-users URL even at the cost of making future code archaeology more difficult, then I can live with that.
/to @bajtos
/cc @ritch
See #386